package com.showgood.beans.handler;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.showgood.beans.proxy.PushProxy;
import com.showgood.socket.Session;
import com.showgood.util.SangoConst;
import com.showgood.vo.BaseVO;

public abstract class SingleVoArrayReplyHandler<T, U extends BaseVO> extends AbstractSingleVoHandler implements ISingleVoHandler<T> {
	@Autowired
	private PushProxy pushProxy;
	@Override
	public int execute(Session userSession, int message, int stamp, T vo) {
		List<U> data = handle(userSession, vo);
		if (data != null && data.size() > 0) {
			pushProxy.push(userSession, message, stamp, data);
		}
		return SangoConst.OK;
	}
	abstract protected List<U> handle(Session userSession, T vo);
}


